import numpy as np

class LinearRegressionClassifier:
    def __init__(self, learning_rate=0.01, num_iterations=1000):
        self.learning_rate = learning_rate
        self.num_iterations = num_iterations
        self.weights = None
        self.bias = None

    def fit(self, X, y):
        num_samples, num_features = X.shape
        self.weights = np.zeros(num_features)
        self.bias = 0

        for i in range(self.num_iterations):
            y_predicted = np.dot(X, self.weights) + self.bias

            dw = (1 / num_samples) * np.dot(X.T, (y_predicted - y))
            db = (1 / num_samples) * np.sum(y_predicted - y)

            self.weights -= self.learning_rate * dw
            self.bias -= self.learning_rate * db

    def predict(self, X):
        y_predicted = np.dot(X, self.weights) + self.bias
        return np.where(y_predicted >= 0, 1, 0)
# Example usage:
X_train = np.array([[1, 2], [4, 8], [5, 10]])
y_train = np.array([2, 2, 2])

clf = LinearRegressionClassifier()
clf.fit(X_train, y_train)

X_test = np.array([[0, -1], [4, 7]])
y_pred = clf.predict(X_test)


print(y_pred.shape)
print(X_test.shape)

print(y_pred)
